/*******************************************
Module: zt_tcp.h
E-Mail: 24zhutian@gmail.com
Notices: Copyright (c) 2007-2011 ls
*******************************************/
#ifndef zt_tcp_h
#define zt_tcp_h

#ifdef __cplusplus
extern "C" {
#endif

#define ZT_TCP_CONNECT_NONE		0x0
#define ZT_TCP_CONNECT_NONBLOCK	0x01

ZT_API zt_socket_t zt_tcp_create();

ZT_API int zt_tcp_init();
ZT_API void zt_tcp_clear();

ZT_API zt_socket_t zt_tcp_connect(char *addr,int port);
ZT_API zt_socket_t zt_tcp_connect_nonblock(char *addr,int port);

ZT_API zt_socket_t zt_tcp_server(int port,char *bindaddr);
ZT_API zt_socket_t zt_tcp_accept(zt_socket_t s,u_char *ip,int *port);

ZT_API int	zt_tcp_nodelay(zt_socket_t fd);
ZT_API int	zt_tcp_keepalive(zt_socket_t fd);
ZT_API int	zt_tcp_nonblocking(zt_socket_t fd);

#ifdef __cplusplus
}
#endif /* C++ */
#endif /* zt_tcp_h */
